package com.jzo2o.foundations.controller.consumer;


import com.jzo2o.foundations.model.dto.response.*;
import com.jzo2o.foundations.service.IServeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 区域表 前端控制器
 * </p>
 *
 * @author itcast
 * @since 2023-07-03
 */
@RestController("consumerServeController")
@RequestMapping("/customer/serve")
@Api(tags = "用户端 - 区域相关接口")
public class ServeController {
    @Autowired
    private IServeService iServeService;
    @GetMapping("/firstPageServeList")
    @ApiOperation("获取首页服务列表")
    public List<ServeCategoryResDTO> getFirstPageServeList(Long regionId) {
        return iServeService.getFirstPageServeList(regionId);
    }

    @GetMapping("/hotServeList")
    @ApiOperation("获取首页的精选推荐")
    public List<ServeAggregationSimpleResDTO> getHotServeList(Long regionId) {
        return iServeService.getHotServeList(regionId);
    }
    @GetMapping("/{id}")
    @ApiOperation("获取服务详情接口")
    public ServeAggregationSimpleResDTO getHotServeInfo(@PathVariable("id") Long id) {
        return iServeService.getHotServeInfo(id);
    }

    @GetMapping("/serveTypeList")
    @ApiOperation("根据区域ID获取全部服务分类")
    public List<ServeAggregationTypeSimpleResDTO> getServeTypeList(Long regionId) {
        return iServeService.getServeTypeList(regionId);
    }
    @GetMapping("/search")
    @ApiOperation("服务搜索")
    public List<ServeSimpleResDTO> search(String cityCode, String keyword, Long serveTypeId) {
        return iServeService.search(cityCode, keyword, serveTypeId);
    }
}
